package com.ysqcould.allocation.service.impl;


import com.ysqcould.allocation.domain.JbFinanceConfig;
import com.ysqcould.allocation.mapper.JbFinanceConfigMapper;
import com.ysqcould.allocation.service.IJbFinanceConfigService;
import com.ysqcould.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 数据大屏Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-06-30
 */
@Service
public class JbFinanceConfigServiceImpl implements IJbFinanceConfigService
{
    @Autowired
    private JbFinanceConfigMapper jbFinanceConfigMapper;

    /**
     * 查询数据大屏
     * 
     * @param id 数据大屏主键
     * @return 数据大屏
     */
    @Override
    public JbFinanceConfig selectJbFinanceConfigById(Long id)
    {
        return jbFinanceConfigMapper.selectJbFinanceConfigById(id);
    }

    /**
     * 查询数据大屏列表
     * 
     * @param jbFinanceConfig 数据大屏
     * @return 数据大屏
     */
    @Override
    public List<JbFinanceConfig> selectJbFinanceConfigList(JbFinanceConfig jbFinanceConfig)
    {
        return jbFinanceConfigMapper.selectJbFinanceConfigList(jbFinanceConfig);
    }

    /**
     * 新增数据大屏
     * 
     * @param jbFinanceConfig 数据大屏
     * @return 结果
     */
    @Override
    public int insertJbFinanceConfig(JbFinanceConfig jbFinanceConfig)
    {
        jbFinanceConfig.setCreateTime(DateUtils.getNowDate());
        return jbFinanceConfigMapper.insertJbFinanceConfig(jbFinanceConfig);
    }

    /**
     * 修改数据大屏
     * 
     * @param jbFinanceConfig 数据大屏
     * @return 结果
     */
    @Override
    public int updateJbFinanceConfig(JbFinanceConfig jbFinanceConfig)
    {
        jbFinanceConfig.setUpdateTime(DateUtils.getNowDate());
        return jbFinanceConfigMapper.updateJbFinanceConfig(jbFinanceConfig);
    }

    /**
     * 批量删除数据大屏
     * 
     * @param ids 需要删除的数据大屏主键
     * @return 结果
     */
    @Override
    public int deleteJbFinanceConfigByIds(Long[] ids)
    {
        return jbFinanceConfigMapper.deleteJbFinanceConfigByIds(ids);
    }

    /**
     * 删除数据大屏信息
     * 
     * @param id 数据大屏主键
     * @return 结果
     */
    @Override
    public int deleteJbFinanceConfigById(Long id)
    {
        return jbFinanceConfigMapper.deleteJbFinanceConfigById(id);
    }

    @Override
    public int updateStatus(JbFinanceConfig financeConfig) {
        JbFinanceConfig jbFinanceConfig = jbFinanceConfigMapper.selectJbFinanceConfigById(financeConfig.getId());
        jbFinanceConfig.setConfigType(financeConfig.getConfigType());
        return jbFinanceConfigMapper.updateJbFinanceConfig(jbFinanceConfig);
    }
}
